<?php
//$redis = new Redis();
//$redis->connect('127.0.0.1', 6379);
//$order = [
//    'id' => 1,
//    'name' => '小米6',
//    'price' => 2499,
//    'created_at' => '2017-07-14'
//];
//$redis->publish("order", json_encode($order));

require_once './RedisOp.php';
require_once './Task.php';
$redis = RedisOp::instance();
// 解决Redis客户端订阅时候超时情况
$redis->setOption();
$redis->psubscribe(array('__keyevent@0__:expired'), function ($redis, $pattern, $chan, $msg)
{
//    echo "Pattern: $pattern\n";
//    echo "Channel: $chan\n";
    echo "Payload: $msg\n\n";
//    echo $redis->get($msg);

    Task::exec($msg);
});
// 回调函数,这里写处理逻辑
